<template>
  <div class="dataVTitle fx-flex  fx-align-center">
    <ClockView class="fx-flex-1"></ClockView>

    <div class="titleName fx-flex-1">监管大屏</div>

    <div class="btn fx-flex fx-flex-1 fx-justity-end">
      <!-- <el-button plain type="success">返回</el-button> -->
      <!-- <div class="back">返回</div> -->

      <div class="header-btn  fx__hover" @click="fullDisplay">{{fullscreen ? '退出全屏' : '全屏显示'}}</div>
    </div>
  </div>
</template>
<script>
export default {
  name: "dataVTitle",
  components: {
    ClockView: () => import("./clock.vue"),
  },
  data() {
    return {
      fullscreen: false,
    };
  },
  methods: {
    throttle(fn, delay) {
      let timer = null;
      return function () {
        let context = this;
        let args = arguments;
        if (!timer) {
          timer = setTimeout(function () {
            fn.apply(context, args);
            timer = null;
          }, delay);
        }
      };
    },
    fullDisplay() {
      let fullarea = this.$parent.$refs.bigScreen;
      if (this.fullscreen) {
        // 退出全屏
        if (fullarea.exitFullscreen) {
          document.exitFullscreen();
        } else if (document.webkitCancelFullScreen) {
          document.webkitCancelFullScreen();
        } else if (document.mozCancelFullScreen) {
          document.mozCancelFullScreen();
        } else if (document.msExitFullscreen) {
          document.msExitFullscreen();
        }
      } else {
        // 进入全屏
        if (fullarea.requestFullscreen) {
          fullarea.requestFullscreen();
        } else if (fullarea.webkitRequestFullScreen) {
          fullarea.webkitRequestFullScreen();
        } else if (fullarea.mozRequestFullScreen) {
          fullarea.mozRequestFullScreen();
        } else if (fullarea.msRequestFullscreen) {
          // IE11
          fullarea.msRequestFullscreen();
        }
      }
      this.fullscreen = !this.fullscreen;
    },
  },
};
</script>
<style lang="scss" scoped>
.dataVTitle {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: url("~@/assets/img/headbg-green@2x.png") no-repeat;
  background-size: 100% 100%;
  .titleName {
    text-align: center;
    font-size: 30px;
    font-family: "PingFang SC";
    font-weight: bold;
    color: rgb(255, 255, 255);
    opacity: 0.99;
    text-shadow: rgba(113, 113, 113, 0.75) 0px 2px 9px;
  }
  .btn {
    padding-right: 24px;
    font-size: 12px;
    .header-btn {
      // padding: 10px 16px;
      color: rgb(126, 253, 174);
      background-color: rgba(126, 253, 174, 0.1);
      border: 1px solid rgb(126, 253, 174);
      border-radius: 6px;
      width: 98px;
      height: 36px;
      line-height: 36px;
      text-align: center;
      cursor: pointer;
      user-select: none;
    }
  }
}
</style>